import { applyMiddleware, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import reducer from './reducers/filmReducer'

// 自定义中间件
const fn = store => next => action => {
    return next(action)
}

export default createStore(
    reducer,
    // 生效中间件
    process.env.NODE_ENV === 'development' ? composeWithDevTools(applyMiddleware(thunk,fn)) : applyMiddleware(thunk,fn)
)